# coding=utf-8
# !/usr/bin/python3
# @Time:2021/3/3 8:55 上午
# @Author:wangyun
# @File:views.py
from django.contrib.auth.mixins import LoginRequiredMixin
from django import http
from .response_code import RETCODE


class LoginRequiredJSONMixin(LoginRequiredMixin):
    """自定义扩展方法"""

    def handle_no_permission(self):
        """响应json数据"""
        return http.JsonResponse({'code': RETCODE.SESSIONERR,
                                  'errmsg': '用户未登录'}
                                 )
